/* DicomFileReader.h -- Header file for class DicomFileReader
*
* TotalDcmLister - A lister plugin for Total Commander for listing DICOM File content.
*
* Copyright (C) 2015 Captain Stark
*
* This software may be modified and distributed under the terms of the MIT license.
* See the COPYRIGHT file at the top-level directory of this distribution for details.
*/

#pragma once

#include "stdafx.h"

#include <string>

#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dctk.h"

#include "DicomAttributeGroup.h"

using namespace std;

/// <summary>
/// Provides means for reading DICOM files.
/// </summary>
class DicomFileReader
{
public:
   /// <summary>
   /// Initializes a new instance of the <see cref="DicomFileReader"/> class.
   /// </summary>
   /// <param name="dcmDataset">The DICOM file to extract data from.</param>
   DicomFileReader(const string& fileName);

   /// <summary>
   /// Finalizes an instance of the <see cref="DicomFileReader"/> class.
   /// </summary>
   ~DicomFileReader();

   /// <summary>
   /// Determines whether the specified DICOM attribute exists in the loaded file.
   /// </summary>
   /// <param name="tag">The DICOM tag (full DICOM path allowed).</param>
   /// <returns>True, when the DICOM attribute exists. False otherwise.</returns>
   bool HasAttribute(const wstring& tag);

   /// <summary>
   /// Gets the DICOM attribute's value as string or the specified default value in case of error.
   /// </summary>
   /// <param name="tag">The DICOM tag (full DICOM path allowed).</param>
   /// <param name="defaultValue">The default value.</param>
   /// <returns>The DICOM attribute's value as string.</returns>
   wstring GetAttributeValue(const wstring& tag, const wstring& defaultValue);

   /// <summary>
   /// Gets the name of the SOP class currently loaded.
   /// </summary>
   /// <returns></returns>
   wstring GetSopClassName();

private:
   DcmFileFormat m_dicomFile;
   DcmDataset* m_dicomDataset;
   wstring m_loadedSopClass;
};

